package lab02.test13;


public class Gymnastics extends ComputerAverage {
    @Override
    double average(double[] scores) {
        double sum = 0;

        for (int i = 0; i < scores.length; i++) {
            for (int j = i + 1; j < scores.length; j++) {
                double min = scores[i];
                if (scores[i] < scores[j]) {
                    continue;
                } else {
                    scores[i] = scores[j];
                    scores[j] = min;
                }
            }
        }
        for (int i = 1; i < scores.length - 1; i++) {
            sum += scores[i];
        }

        return sum / (scores.length - 2);
    }
}
